package com.backend.modules.statistics.vo;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.List;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

@Data
@Schema(description = "学生统计数据")
public class StudentStatisticsVO {
    
    @Schema(description = "任务概览")
    private TaskOverview taskOverview;
    
    @Schema(description = "提交历史")
    private List<SubmissionHistory> submissionHistory;
    
    @Schema(description = "班级排名")
    private ClassRanking classRanking;
    
    @Data
    public static class TaskOverview {
        @Schema(description = "进行中任务")
        private Integer ongoingTasks;
        
        @Schema(description = "已完成任务")
        private Integer completedTasks;
        
        @Schema(description = "逾期任务")
        private Integer overdueTasks;
        
        @Schema(description = "提交率")
        private Double submitRate;
    }
    
    @Data
    public static class SubmissionHistory {
        @Schema(description = "任务名称")
        private String taskName;
        
        @Schema(description = "提交时间")
        private String submitTime;
        
        @Schema(description = "审核状态")
        private String status;
        
        @Schema(description = "审核意见")
        private String comment;
        
        public SubmissionHistory(String taskName, LocalDateTime submitTime, 
                String status, String comment) {
            this.taskName = taskName;
            this.submitTime = submitTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
            this.status = status;
            this.comment = comment;
        }
        
        public SubmissionHistory() {
        }
    }
    
    @Data
    public static class ClassRanking {
        @Schema(description = "班级人数")
        private Integer totalStudents;
        
        @Schema(description = "当前排名")
        private Integer currentRank;
        
        @Schema(description = "提交率")
        private Double submitRate;
        
        @Schema(description = "班级平均提交率")
        private Double classAverageRate;
        
        public ClassRanking(Long totalStudents, Long currentRank, 
                Double submitRate, Double classAverageRate) {
            this.totalStudents = totalStudents.intValue();
            this.currentRank = currentRank.intValue();
            this.submitRate = submitRate;
            this.classAverageRate = classAverageRate;
        }
        
        public ClassRanking() {
        }
    }
} 